Reads the item at the FRONT of target WITHOUT removing it. If target is empty, returns a plain default value instead (see queue_pop's own note on what that is per type) - target is left unchanged either way.
queue_peek(target) -> element| Name | Type |
|---|---|
target | queue |
element
Reads the item at the FRONT of target WITHOUT removing it. target is left unchanged either way.
If target is empty, returns a plain default value instead - the same rule queue_pop uses (0/0.0/false/an empty string/nothing, depending on target's element type). Useful for checking who is next before actually advancing the queue.
/// @type {queue<int>}
/// @capacity 4
var turn_order = [1, 2, 3];
var next_up = queue_peek(turn_order); // 1 - turn_order is still [1, 2, 3]



the GBA module's own deque front() - O(1), guarded by an empty() check first so it is never called on an empty deque (which would be undefined behavior, not just a wrong answer).